Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
better-custom-error
Advanced tools
Helper for creating Error subclass with bonus features. It fully works with Babel (as opposed to native ES6 `class`), allows to pass custom data to errors and it contains features useful for logging/debugging.
Helper for creating Error subclass with bonus features.
It fully works with Babel (as opposed to native ES6 class
), allows to pass custom data to errors and it contains
features useful for logging/debugging.
Cleaner code.
instanceof
works as expected with multi level inheritance.Easy to use
null
or undefined
and it won't crash so you don't need to care about
variable/property existence/initialization check.Enables better logging and bug tracking:
Full documentation available here: documentation.
yarn add better-custom-error
or npm i better-custom-error --save
// If you're ready for ES6 code with modules syntax use
import createError from "better-custom-error";
// If you're not ready for it, use
const createError = require("better-custom-error/dist").default;
const MyError = createError("MyError");
const AnotherError = createError("AnotherError", MyError); // it extends `Error` by default, but you can pass another error
const YetAnotherError = createError("YetAnotherError", Error, options);
For options
see: Options Usage.
Imporant: creating two errors with the same name will create two different errors references anyway! Export them and import where needed or make your errors global.
better-custom-error
features will be available on native errors tooextend
method for easier extendingMIT
FAQs
This library is deprecated. Use [@ezez/errors](https://www.npmjs.com/package/@ezez/errors) instead.
The npm package better-custom-error receives a total of 140 weekly downloads. As such, better-custom-error popularity was classified as not popular.
We found that better-custom-error demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.